<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\Base;

class PreparatoryServer extends Base
{

    public array $scenes = [
        'v1.create' => 'username,nickname,mobile,avatar,state,expire_time,community_id,community_name',
        'v1.list' => 'noPage,pageSize',
        'v1.detail' => 'id',
        'v1.modify' => 'id,username,nickname,mobile,avatar,state,expire_time,community_id,community_name',
        'v1.delete' => 'id',
    ];


    public function rules(): array
    {
        return [
            'id' => 'bail|required',
            'username' => 'bail|required|string',
            'nickname' => 'bail|required|string',
            'password' => 'bail|required',
            'mobile' => 'bail|required',
            'avatar' => 'bail|required',
            'state' => 'bail|required|int|in:0,1,2',
            'expire_time' => 'bail|required',
            'community_id' => 'bail|required',
            'community_name' => 'bail|required',
            'noPage' => 'bail|nullable|min:1|numeric',
            'pageSize' => 'bail|nullable|min:1|numeric',

        ];
    }


    public function messages(): array
    {
        return [

            'id.required' => 'id不能为空',

            'username.required' => '用户名不能为空',
            'username.string' => '用户名不正确',

            'nickname.required' => '筹备组名字不能为空',
            'nickname.string' => '筹备组名字格式不正确',

            'password.required' => '密码不能为空',
            'mobile.required' => '电话不能为空',
            'avatar.required' => '头像不能为空',
            'expire_time.required' => '到期时间不能为空',
            'community_id.required' => '小区id不能为空',
            'community_name.required' => '小区名不能为空',



            'state.required' => '状态不能为空',
            'state.in' => '状态值不支持',

            'noPage.min' => '页码不能小于1',
            'noPage.numeric' => '页码格式非法',
            'pageSize.min' => '查询条数不能小于1',
            'pageSize.numeric' => '查询条数格式非法',


        ];
    }

}
